package com.maxd.modules.coupon.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.sql.Date;

/**
 * @Auther: Laban:yubo_010@163.com
 * @Date: 2020/11/14 18:26
 * @Description:
 */
@Data
@Entity
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Table(name = "sqx_coupon_order_detail")
@ApiModel(value = "sqx_coupon_order_detail对象", description = "用户订单优惠明细管理")
public class CouponOrderDetail implements Serializable {

    @Id()
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    /**主键ID*/
    private Long id;

    @Column(name = "create_time")
    /**创建时间*/
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    private java.util.Date createTime;

    @Column(name = "user_id")
    /**用户ID*/
    private String userId;

    @Column(name = "order_id")
    /**订单ID*/
    private String orderId;

    @Column(name = "product_id")
    /**商品ID*/
    private String productId;

    @Column(name = "coupon_amount")
    /**优惠券价格*/
    private String couponAmount;

    /**商品名称*/
    @Column(name = "product_title")
    /**优惠券价格*/
    private String productTitle;

    public CouponOrderDetail saveCouponOrderDetail(java.util.Date createTime,String userId,
                                                   String orderId,String productId,String couponAmount,String productTitle){
        CouponOrderDetail couponOrderDetail = new CouponOrderDetail();
        couponOrderDetail.setCreateTime(createTime);
        couponOrderDetail.setUserId(userId);
        couponOrderDetail.setOrderId(orderId);
        couponOrderDetail.setProductId(productId);
        couponOrderDetail.setCouponAmount(couponAmount);
        couponOrderDetail.setProductTitle(productTitle);
        return couponOrderDetail;
    }
}
